# 变量的类型注解
import json
import random

# 基础数据类型
# var_1: int = 10
# var_2: str = "itheima"
# var_3: bool = True

# 类对象
# class Student:
#     pass

stu:Student = Student()

# 数据容器类型
# my_list: list = [1, 2, 3]
# my_tuple: tuple = (1, 2, 3)
# my_set: set = {1, 2, 3}
# my_dict: dict = {'a': 1, 'b': 2}

# 数据容器内部详细注解
# my_list: list[int] = [1, 2, 3]
# my_tuple: tuple[int, str, bool] = (1, 'itheima', True)
# my_dict: dict[str, int] = {'a': 1, 'b': 2}



# 在注释中进行类型注解
# var_1  = random.randint(1,10)  # type: int
# var_2 = json.loads('{"name":"张三"}')  # type: dict[str, str]
# def func():
#     return 10
# var_3 = func()  # type: int
#
# # 类型注解的限制(不是强制性的)
# var_4: int = "itheima"
# var_5: str = 132



# 对形参进行类型注解
def add(x: int,y: int):
    return x + y

add(1,2)
# 对函数返回值进行类型注解
def func(data: list) -> list:
    return data

func([1,2,3])

# 语法如下：
# def 函数方法名(形参: 类型, ...... , 形参: 类型) -> 返回值类型:
#     pass


